/*
 *d2_3_3.cpp
 *Create by Administrator
 * 2017年1月19日
 * 下午4:49:20
 */
#include <iostream>

int main() {
//	int ival =1024;
//	int *pi = &ival;
//	int **ppi = &pi;
//
//	std::cout << "The value of ival\n"
//			   <<"direct value: "<<ival<<"\n"
//			   <<"indirect value: "<< *pi<<"\n"
//			   <<"doubly indirect value: "<<**ppi
//			   <<std::endl;

	int i = 42;
	int *p;
	int *&r = p;  //r是一个对指针p的引用

	r = &i;   //r引用了一个指针，因此给r赋值&i就是令p指向i  等价于     p=&i;

	*r = 0;

	std::cout << "  *p  " << *p << "  " << "  *r  " << *r << std::endl;
	std::cout << " i "<<i <<"  *p  "<<*p << "*r" <<*r<<std::endl;
	return 0;
}
